package cn.lx.log.core.util;

import org.aopalliance.intercept.MethodInvocation;

import java.lang.reflect.Method;

/**
 * @author lX
 * @version JDK 8
 * @className MethodInvocationUtil (此处以class为例)
 * @date 2024/5/22
 * @description TODO
 */
public class MethodInvocationUtil {

    public MethodInvocationUtil() {
    }

    public static Method getActualMethod(MethodInvocation methodInvocation) {
        try {
            Method method = methodInvocation.getMethod();
            Object target = methodInvocation.getThis();
            return target.getClass().getMethod(method.getName(), method.getParameterTypes());
        } catch (NoSuchMethodException e) {
            throw  new RuntimeException(e);
        }
    }
}
